<?php
ob_start('ob_gzhandler');
session_start();

function nonexist()
{
header("Location: http://www.tripod.lycos.nl/errors/403.phtml");
exit();
}

$ckey=$_COOKIE['specukey'];

if(!isset($ckey)) {
nonexist();
}

mysql_connect(localhost, $username, $password);
mysql_select_db($database);
$res = mysql_query("SELECT * FROM gotm_specuser WHERE ukey = '$ckey'");
$result = mysql_result($res, 0, "ukey");
$hcheck = mysql_result($res, 0, "hname");
$vdate = mysql_result($res, 0, "valid");
$uname = mysql_result($res, 0, "uname");
$alevel = mysql_result($res, 0, "rank");
$_SESSION['alevel'] = $alevel;
$_SESSION['uname'] = $uname;
mysql_close();

if($result === !$_COOKIE['specukey'])
{
nonexist();
}

#if($hcheck === !$REMOTE_ADDR)
#{
#nonexist();
#}
#Host checking not working on testing lycos-account! Lycos I hate you! :)
$cdate = date("z");

if($cdate > $vdate)
{
header("Location: http://members.lycos.nl/dragonballpalace2/alpha/crew/genkey.php");
exit;
}
?>
